index.html.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <!-- 导航栏 -->
  5. <HomePageNavigation1></HomePageNavigation1>
  6. <!-- 列表页广告一 -->
  7. <HomeTopTen :imgurl="adImg1" v-if="adImg1"></HomeTopTen>
  8. <!-- 面包屑导航 -->
  9. <div class="breadcrumb">
  10. <div class="inner">
  11. <span class="location">当前位置:</span>
  12. <el-breadcrumb :separator-icon="ArrowRight">
  13. <el-breadcrumb-item>
  14. <NuxtLink to="/">首页</NuxtLink>
  15. </el-breadcrumb-item>
  16. <el-breadcrumb-item>
  17. {{ newsDetail.con_title }}
  18. </el-breadcrumb-item>
  19. </el-breadcrumb>
  20. </div>
  21. </div>
  22. <!-- 资讯列表 -->
  23. <div class="newsDetail">
  24. <div class="inner">
  25. <div class="innerLeft">
  26. <div class="leftBottomTitle">{{ newsDetail.con_title }}</div>
  27. <div class="leftBottom" v-html="newsDetail.content" v-if="newsDetail.content"></div>
  28. </div>
  29. <div class="innerRight">
  30. <div class="rightMenuTitle">导航列表</div>
  31. <ul>
  32. <li v-for="(item, index) in bottomMenu" :key="index">
  33. <NuxtLink v-if="item.type == 0" :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  34. :class="item.id == pageId ? 'active' : ''">
  35. {{ item.name }}
  36. </NuxtLink>
  37. <NuxtLink v-else-if="item.type == 1" :to="`/about/${item.name_pinyin}/list-1.html`"
  38. :title="item.name" :class="item.id == pageId ? 'active' : ''">
  39. {{ item.name }}
  40. </NuxtLink>
  41. </li>
  42. </ul>
  43. </div>
  44. <div style="clear: both;"></div>
  45. </div>
  46. </div>
  47. <!-- 广告二 -->
  48. <HomeTopTen :imgurl="adImg2" v-if="adImg2"></HomeTopTen>
  49. <!-- 页面底部 -->
  50. <HomeFoot1></HomeFoot1>
  51. </template>
  52. <script setup>
  53. //1.页面依赖 start ---------------------------------------->
  54. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  55. import { ArrowRight } from '@element-plus/icons-vue'
  56. import { ref, onMounted } from 'vue';
  57. //获得跳转过来的id
  58. const route = useRoute();
  59. //获得当前的完整路径
  60. const fullPath = route.path;
  61. //拆分,取出来中间这一段,然后提取数字部分
  62. const segments = fullPath.split('/');
  63. const targetSegment = segments[2];
  64. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  65. let articleId;
  66. let pageId;
  67. //通过导航路径反向查询导航id
  68. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  69. method: 'GET',
  70. query: {
  71. 'foot_pinyin': targetSegment,
  72. },
  73. });
  74. if (getRouteId.code == 200) {
  75. articleId = getRouteId.data.id;
  76. pageId = getRouteId.data.id;
  77. } else {
  78. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  79. // console.log("错误位置:通过url路径查询导航池id")
  80. // console.log("后端错误反馈:",getRouteId.message)
  81. // console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  82. }
  83. //1.页面依赖 end ---------------------------------------->
  84. //2.页面数据 start ---------------------------------------->
  85. //广告列表
  86. const adList = ref([]);
  87. let adImg1 = ref([]);
  88. let adImg2 = ref([]);
  89. async function getAdData() {
  90. const adData = await requestDataPromise('/web/getWebsiteAdvertisement', { method: 'GET', query: { 'ad_tag': 'PAGE' } });
  91. adList.value = adData.data;
  92. if (adData.code == 200) {
  93. for (let item of adData.data) {
  94. if (item.ad_tag == 'PAGE_0001') {
  95. adImg1.value = item;
  96. }
  97. if (item.ad_tag == 'PAGE_0002') {
  98. adImg2.value = item;
  99. }
  100. }
  101. } else {
  102. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  103. console.log("错误位置:获取详情页广告列表")
  104. console.log("后端错误反馈:", adData.message)
  105. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  106. }
  107. }
  108. getAdData();
  109. const newsDetail = ref({})
  110. const bottomMenu = ref([]);
  111. async function getPageData() {
  112. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  113. method: 'GET',
  114. query: {
  115. 'fcat_id': articleId
  116. },
  117. });
  118. newsDetail.value = mkdata.data;
  119. }
  120. getPageData();
  121. async function getPageMenu() {
  122. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  123. method: 'GET',
  124. query: {},
  125. });
  126. bottomMenu.value = mkdata.data;
  127. }
  128. getPageMenu();
  129. //2.页面数据 end ---------------------------------------->
  130. //4.设置seo信息 start---------------------------------------->
  131. //4.1 设置seo信息
  132. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  133. method: 'GET',
  134. query: {},
  135. });
  136. let seoTitle = setData.data.website_head.title;
  137. let seoDescription = setData.data.website_head.description;
  138. let seoKeywords = setData.data.website_head.keywords;
  139. let seoSuffix = setData.data.website_head.suffix;
  140. let seoName = setData.data.website_head.website_name;
  141. useSeoMeta({
  142. title: seoTitle + "_" + seoSuffix,
  143. meta: [
  144. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  145. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  146. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no',tagPriority: 10 }
  147. ]
  148. });
  149. //4.设置seo信息 end---------------------------------------->
  150. onMounted(async () => {
  151. //从客户端获取行政职能部门 加快打开速度
  152. const { $webUrl, $CwebUrl } = useNuxtApp();
  153. //广告1
  154. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_page_0001`
  155. const responseAd1 = await fetch(url, {
  156. headers: {
  157. 'Content-Type': 'application/json',
  158. 'Userurl': $CwebUrl,
  159. 'Origin': $CwebUrl
  160. }
  161. });
  162. const resultAd1 = await responseAd1.json();
  163. adImg1.value = resultAd1.data[0];
  164. //广告2
  165. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=snzxw_page_0002`
  166. const responseAd2 = await fetch(url2, {
  167. headers: {
  168. 'Content-Type': 'application/json',
  169. 'Userurl': $CwebUrl,
  170. 'Origin': $CwebUrl
  171. }
  172. });
  173. const resultAd2 = await responseAd2.json();
  174. adImg2.value = resultAd2.data[0];
  175. })
  176. </script>
  177. <style lang="less" scoped>
  178. //导航条
  179. .breadcrumb {
  180. width: 100%;
  181. height: 22px;
  182. margin-bottom: 30px;
  183. font-family: Microsoft YaHei, Microsoft YaHei;
  184. font-weight: 400;
  185. font-size: 20px;
  186. color: #666666;
  187. line-height: 23px;
  188. text-align: left;
  189. font-style: normal;
  190. text-transform: none;
  191. .el-breadcrumb::v-deep {
  192. display: inline-block;
  193. vertical-align: -4px;
  194. }
  195. /deep/.el-breadcrumb__inner a,
  196. /deep/.el-breadcrumb__inner.is-link {
  197. color: #666666;
  198. font-weight: 400;
  199. text-decoration: none;
  200. transition: var(--el-transition-color);
  201. }
  202. span {
  203. font-family: Microsoft YaHei, Microsoft YaHei;
  204. font-weight: 400;
  205. font-size: 20px;
  206. color: #666666;
  207. line-height: 23px;
  208. text-align: left;
  209. font-style: normal;
  210. text-transform: none;
  211. }
  212. span:hover {
  213. color: #666666;
  214. }
  215. .location {
  216. margin-right: 5px;
  217. width: 100px;
  218. height: 22px;
  219. font-family: Microsoft YaHei, Microsoft YaHei;
  220. font-weight: 400;
  221. font-size: 20px;
  222. color: #666666;
  223. line-height: 23px;
  224. text-align: left;
  225. font-style: normal;
  226. text-transform: none;
  227. }
  228. }
  229. // 资讯列表
  230. .newsDetail {
  231. width: 100%;
  232. //height: 1400px;
  233. margin-bottom: 70px;
  234. .inner {
  235. width: 1200px;
  236. //height: 1400px;
  237. font-size: 16px;
  238. .innerLeft {
  239. //height: 1400px;
  240. float: right;
  241. .LeftTop {
  242. //height: 522px;
  243. margin-top: 50px;
  244. >h1 {
  245. line-height: 40px;
  246. margin-bottom: 30px;
  247. font-family: Microsoft YaHei, Microsoft YaHei;
  248. font-weight: bold;
  249. font-size: 30px;
  250. color: #333333;
  251. }
  252. >p {
  253. height: 18px;
  254. line-height: 18px;
  255. font-family: Microsoft YaHei, Microsoft YaHei;
  256. font-weight: 400;
  257. font-size: 14px;
  258. color: #999999;
  259. span {
  260. margin-right: 40px;
  261. }
  262. }
  263. >img {
  264. width: 680px;
  265. height: 382px;
  266. padding: 50px 0px 60px 55px;
  267. }
  268. }
  269. .leftBottomTitle {
  270. color: #028E21;
  271. font-size: 24px;
  272. font-weight: bold;
  273. height: 60px;
  274. line-height: 60px;
  275. }
  276. .leftBottom {
  277. width: 790px;
  278. font-size: 20px;
  279. border-top: 1px solid #139602;
  280. padding-top: 40px;
  281. >h3,
  282. >p {
  283. text-indent: 2em;
  284. width: 790px;
  285. font-family: Microsoft YaHei, Microsoft YaHei;
  286. font-size: 20px;
  287. color: #333333;
  288. line-height: 23px;
  289. padding-bottom: 30px;
  290. }
  291. >h3 {
  292. font-weight: 600px;
  293. }
  294. >p {
  295. font-weight: 400;
  296. }
  297. }
  298. }
  299. .innerRight {
  300. width: 279px;
  301. .rightMenuTitle {
  302. width: 279px;
  303. height: 69px;
  304. font-size: 22px;
  305. font-weight: bold;
  306. line-height: 58px;
  307. text-align: center;
  308. color: #fff;
  309. background: url("http://img.bjzxtw.org.cn/master/bjzxtw/public/special/projectMoreTitle.png") no-repeat;
  310. margin-bottom: 30px;
  311. }
  312. ul {
  313. li {
  314. a {
  315. border-left: 5px solid #028E21;
  316. margin-bottom: 15px;
  317. font-size: 22px;
  318. display: block;
  319. height: 61px;
  320. line-height: 61px;
  321. color: #333333;
  322. text-align: center;
  323. background: #FBFBFB;
  324. }
  325. }
  326. }
  327. .active {
  328. border-left: 0;
  329. border: 1px solid #028E21;
  330. background: #fff;
  331. }
  332. }
  333. }
  334. }
  335. </style>
  336. <style lang="less" scoped>
  337. @media screen and (min-width:801px) {
  338. /*pc*/
  339. .pc_none {
  340. display: none;
  341. }
  342. }
  343. @media screen and (max-width:800px) {
  344. /*ipad_phone*/
  345. .breadcrumb {
  346. margin-bottom: 11px;
  347. }
  348. .breadcrumb .location {
  349. font-size: 14px;margin-right:5px;
  350. }
  351. .breadcrumb span {
  352. font-size: 14px;
  353. }
  354. .breadcrumb /deep/.el-breadcrumb {
  355. vertical-align: middle;
  356. }
  357. .newsDetail {
  358. margin: 10px auto 0px;
  359. }
  360. .newsDetail .inner {
  361. width: 92%;
  362. margin: 0px auto 11px;
  363. overflow: hidden;
  364. }
  365. .newsDetail .inner .innerRight {
  366. width: 24%;
  367. display: none;
  368. }
  369. .newsDetail .inner .innerRight .rightMenuTitle {
  370. width: 100%;
  371. height: auto;
  372. background-size: 100% 155%;
  373. margin-bottom: 11px;
  374. display: block;
  375. width: 100%;
  376. height: auto;
  377. line-height: 33px;
  378. font-size: 14px;
  379. text-align: center;
  380. }
  381. .newsDetail .inner .innerRight .rightMenuTitle a {}
  382. .newsDetail .inner .innerRight ul {
  383. display: block;
  384. width: 100%;
  385. height: auto;
  386. }
  387. .newsDetail .inner .innerRight ul li {
  388. display: block;
  389. width: 100%;
  390. height: auto;
  391. }
  392. .newsDetail .inner .innerRight ul li a {
  393. line-height: 20px;
  394. height: auto;
  395. font-size: 12px;
  396. margin-bottom: 5px;
  397. padding: 6px 2px;
  398. box-sizing: border-box;
  399. border-left: 2px solid #028E21;
  400. }
  401. .newsDetail .inner .innerLeft {
  402. width: 100%;
  403. float: none;
  404. overflow: hidden;
  405. margin: 0;
  406. }
  407. .newsDetail .inner .innerLeft .book_son_right {
  408. float: none;
  409. width: 100%;
  410. overflow: hidden;
  411. margin-bottom: 22px;
  412. }
  413. .newsDetail .inner .innerLeft .leftBottomTitle {
  414. height: 50px;
  415. line-height: 50px;
  416. font-size: 18px;
  417. }
  418. .newsDetail .inner .innerLeft .leftBottom {
  419. width: 100%;
  420. padding-top: 11px;
  421. line-height: 22px;
  422. font-size: 16px !important;
  423. }
  424. .newsDetail .inner .innerLeft .leftBottom * {
  425. line-height: 22px;
  426. font-size: 16px !important;
  427. }
  428. .leftBottom /deep/.daohang {}
  429. .leftBottom /deep/.daohang ul {
  430. overflow: hidden;
  431. }
  432. .leftBottom /deep/.daohang li {
  433. float: left;
  434. margin: 1%;
  435. box-sizing: border-box;
  436. border: solid 1px #ddd;
  437. padding: 1vw;
  438. width: 23%;
  439. text-align: center;
  440. }
  441. .leftBottom /deep/.daohang li a {
  442. font-size: 14px !important;
  443. color: #333;
  444. }
  445. // .innerLeft{display:none;}
  446. .phone_none {
  447. display: none;
  448. }
  449. }
  450. </style>